package com.jic.interaction.onlineService.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.jic.interaction.common.exception.AppRuntimeException;
import com.jic.interaction.onlineService.model.vo.request.Order;
import com.jic.interaction.onlineService.model.vo.response.OrderResponse;
import com.jic.interaction.onlineService.service.OnlineService;
import com.jic.member.constant.consist.ResponseCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @Auther YGH
 * @DATE 2020/11/11/13:44
 */

@Service
@Slf4j
public class OnlineServiceImpl implements OnlineService {



    /*
        •	客服查询订单信息
     */

    @Override
    public OrderResponse selectList(Order order) {
        log.info("查询参数 = {}", JSONObject.toJSONString(order));
        if (order.getOrderId() == null && order.getQueryType() == null){
            throw new AppRuntimeException(ResponseCode.EXCEPTION, "传入参数为空");
        }
        OrderResponse dto = new OrderResponse();
        dto.setRetCode("1"); //除了25350000 其它都为失败
        dto.setRetMsg("接口定义未完成");

        //调用接口==================================

        if (order.getQueryType().equals("L")){ //获取query_type 结果为L 就返回订单列表
        return dto ;

        }else if (order.getQueryType().equals("O")){//获取query_type 结果为L 就返回订单
            return dto;
        }

        throw new AppRuntimeException(ResponseCode.EXCEPTION, "query_type 查询方式不存在");


    }
}
